function initCommentModel(sequelize, DataTypes) {
    const Comment = sequelize.define('comment', {
        cid: {
            type: DataTypes.INTEGER,
            primaryKey: true,
            autoIncrement: true,
            field: 'cid'
        },
        uid: {
            type: DataTypes.INTEGER,
            allowNull: false,
            field: 'uid',
            comment: '用户id'
        },
        jid: {
            type: DataTypes.INTEGER,
            allowNull: true,
            field: 'jid',
            comment: '景点id'
        },
        aid: {
            type: DataTypes.INTEGER,
            allowNull: true,
            field: 'aid',
            comment: '文章id'
        },
        content: {
            type: DataTypes.TEXT,
            allowNull: false,
            comment: '评论内容'
        },
        parentId: {
            type: DataTypes.INTEGER,
            allowNull: true,
            field: 'parentId',
            comment: '父评论id，用于回复功能'
        },
        likeCount: {
            type: DataTypes.INTEGER,
            defaultValue: 0,
            field: 'likeCount',
            comment: '点赞次数'
        },
        status: {
            type: DataTypes.ENUM('active', 'deleted', 'hidden'),
            defaultValue: 'active',
            comment: '评论状态'
        },
    }, {
        tableName: 'comment',
        timestamps: false
    });
    
    return Comment;
}

module.exports = initCommentModel;